<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>Class: Spec::Story::StepGroup</title>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <meta http-equiv="Content-Script-Type" content="text/javascript" />
  <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
  <script type="text/javascript">
  // <![CDATA[

  function popupCode( url ) {
    window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
  }

  function toggleCode( id ) {
    if ( document.getElementById )
      elem = document.getElementById( id );
    else if ( document.all )
      elem = eval( "document.all." + id );
    else
      return false;

    elemStyle = elem.style;
    
    if ( elemStyle.display != "block" ) {
      elemStyle.display = "block"
    } else {
      elemStyle.display = "none"
    }

    return true;
  }
  
  // Make codeblocks hidden by default
  document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
  
  // ]]>
  </script>

</head>
<body>



    <div id="classHeader">
        <table class="header-table">
        <tr class="top-aligned-row">
          <td><strong>Class</strong></td>
          <td class="class-name-in-header">Spec::Story::StepGroup</td>
        </tr>
        <tr class="top-aligned-row">
            <td><strong>In:</strong></td>
            <td>
                <a href="../../../files/vendor/plugins/rspec/lib/spec/story/step_group_rb.html">
                vendor/plugins/rspec/lib/spec/story/step_group.rb
                </a>
        <br />
            </td>
        </tr>

        <tr class="top-aligned-row">
            <td><strong>Parent:</strong></td>
            <td>
                <a href="../../Object.html">
                Object
               </a>
            </td>
        </tr>
        </table>
    </div>
  <!-- banner header -->

  <div id="bodyContent">



  <div id="contextContent">



   </div>

    <div id="method-list">
      <h3 class="section-bar">Methods</h3>

      <div class="name-list">
      <a href="#M000162">&lt;&lt;</a>&nbsp;&nbsp;
      <a href="#M000151">Given</a>&nbsp;&nbsp;
      <a href="#M000150">GivenScenario</a>&nbsp;&nbsp;
      <a href="#M000153">Then</a>&nbsp;&nbsp;
      <a href="#M000152">When</a>&nbsp;&nbsp;
      <a href="#M000158">add</a>&nbsp;&nbsp;
      <a href="#M000161">add_to</a>&nbsp;&nbsp;
      <a href="#M000159">clear</a>&nbsp;&nbsp;
      <a href="#M000163">create_matcher</a>&nbsp;&nbsp;
      <a href="#M000160">empty?</a>&nbsp;&nbsp;
      <a href="#M000149">find</a>&nbsp;&nbsp;
      <a href="#M000155">given</a>&nbsp;&nbsp;
      <a href="#M000154">given_scenario</a>&nbsp;&nbsp;
      <a href="#M000148">new</a>&nbsp;&nbsp;
      <a href="#M000147">steps</a>&nbsp;&nbsp;
      <a href="#M000157">then</a>&nbsp;&nbsp;
      <a href="#M000156">when</a>&nbsp;&nbsp;
      </div>
    </div>

  </div>


    <!-- if includes -->

    <div id="section">





      


    <!-- if method_list -->
    <div id="methods">
      <h3 class="section-bar">Public Class methods</h3>

      <div id="method-M000148" class="method-detail">
        <a name="M000148"></a>

        <div class="method-heading">
          <a href="#M000148" class="method-signature">
          <span class="method-name">new</span><span class="method-args">(init_defaults=true, &amp;block)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000148-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000148-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/rspec/lib/spec/story/step_group.rb, line 19</span>
19:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">init_defaults</span>=<span class="ruby-keyword kw">true</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
20:         <span class="ruby-ivar">@hash_of_lists_of_steps</span> = <span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">h</span>, <span class="ruby-identifier">k</span><span class="ruby-operator">|</span> <span class="ruby-identifier">h</span>[<span class="ruby-identifier">k</span>] = []}
21:         <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">init_defaults</span>
22:           <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">steps</span>.<span class="ruby-identifier">add_to</span>(<span class="ruby-keyword kw">self</span>)
23:         <span class="ruby-keyword kw">end</span>
24:         <span class="ruby-identifier">instance_eval</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block</span>
25:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000147" class="method-detail">
        <a name="M000147"></a>

        <div class="method-heading">
          <a href="#M000147" class="method-signature">
          <span class="method-name">steps</span><span class="method-args">(&amp;block)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000147-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000147-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/rspec/lib/spec/story/step_group.rb, line 13</span>
13:       <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">steps</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
14:         <span class="ruby-ivar">@step_group</span> <span class="ruby-operator">||=</span> <span class="ruby-constant">StepGroup</span>.<span class="ruby-identifier">new</span>(<span class="ruby-keyword kw">false</span>)
15:         <span class="ruby-ivar">@step_group</span>.<span class="ruby-identifier">instance_eval</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block</span>
16:         <span class="ruby-ivar">@step_group</span>
17:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <h3 class="section-bar">Public Instance methods</h3>

      <div id="method-M000162" class="method-detail">
        <a name="M000162"></a>

        <div class="method-heading">
          <a href="#M000162" class="method-signature">
          <span class="method-name">&lt;&lt;</span><span class="method-args">(other_step_matchers)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000162-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000162-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/rspec/lib/spec/story/step_group.rb, line 76</span>
76:       <span class="ruby-keyword kw">def</span> <span class="ruby-operator">&lt;&lt;</span>(<span class="ruby-identifier">other_step_matchers</span>)
77:         <span class="ruby-identifier">other_step_matchers</span>.<span class="ruby-identifier">add_to</span>(<span class="ruby-keyword kw">self</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">other_step_matchers</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:add_to</span>)
78:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000151" class="method-detail">
        <a name="M000151"></a>

        <div class="method-heading">
          <a href="#M000151" class="method-signature">
          <span class="method-name">Given</span><span class="method-args">(name, &amp;block)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000151-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000151-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/rspec/lib/spec/story/step_group.rb, line 38</span>
38:       <span class="ruby-keyword kw">def</span> <span class="ruby-constant">Given</span>(<span class="ruby-identifier">name</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
39:         <span class="ruby-identifier">create_matcher</span>(<span class="ruby-identifier">:given</span>, <span class="ruby-identifier">name</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
40:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000150" class="method-detail">
        <a name="M000150"></a>

        <div class="method-heading">
          <a href="#M000150" class="method-signature">
          <span class="method-name">GivenScenario</span><span class="method-args">(name, &amp;block)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000150-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000150-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/rspec/lib/spec/story/step_group.rb, line 34</span>
34:       <span class="ruby-keyword kw">def</span> <span class="ruby-constant">GivenScenario</span>(<span class="ruby-identifier">name</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
35:         <span class="ruby-identifier">create_matcher</span>(<span class="ruby-identifier">:given_scenario</span>, <span class="ruby-identifier">name</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
36:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000153" class="method-detail">
        <a name="M000153"></a>

        <div class="method-heading">
          <a href="#M000153" class="method-signature">
          <span class="method-name">Then</span><span class="method-args">(name, &amp;block)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000153-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000153-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/rspec/lib/spec/story/step_group.rb, line 46</span>
46:       <span class="ruby-keyword kw">def</span> <span class="ruby-constant">Then</span>(<span class="ruby-identifier">name</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
47:         <span class="ruby-identifier">create_matcher</span>(<span class="ruby-identifier">:then</span>, <span class="ruby-identifier">name</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
48:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000152" class="method-detail">
        <a name="M000152"></a>

        <div class="method-heading">
          <a href="#M000152" class="method-signature">
          <span class="method-name">When</span><span class="method-args">(name, &amp;block)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000152-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000152-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/rspec/lib/spec/story/step_group.rb, line 42</span>
42:       <span class="ruby-keyword kw">def</span> <span class="ruby-constant">When</span>(<span class="ruby-identifier">name</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
43:         <span class="ruby-identifier">create_matcher</span>(<span class="ruby-identifier">:when</span>, <span class="ruby-identifier">name</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
44:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000158" class="method-detail">
        <a name="M000158"></a>

        <div class="method-heading">
          <a href="#M000158" class="method-signature">
          <span class="method-name">add</span><span class="method-args">(type, steps)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000158-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000158-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/rspec/lib/spec/story/step_group.rb, line 55</span>
55:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add</span>(<span class="ruby-identifier">type</span>, <span class="ruby-identifier">steps</span>)
56:         (<span class="ruby-ivar">@hash_of_lists_of_steps</span>[<span class="ruby-identifier">type</span>] <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">steps</span>).<span class="ruby-identifier">flatten!</span>
57:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000161" class="method-detail">
        <a name="M000161"></a>

        <div class="method-heading">
          <a href="#M000161" class="method-signature">
          <span class="method-name">add_to</span><span class="method-args">(other_step_matchers)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000161-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000161-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/rspec/lib/spec/story/step_group.rb, line 70</span>
70:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_to</span>(<span class="ruby-identifier">other_step_matchers</span>)
71:         [<span class="ruby-identifier">:given_scenario</span>, <span class="ruby-identifier">:given</span>, <span class="ruby-identifier">:when</span>, <span class="ruby-identifier">:then</span>].<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">type</span><span class="ruby-operator">|</span>
72:           <span class="ruby-identifier">other_step_matchers</span>.<span class="ruby-identifier">add</span>(<span class="ruby-identifier">type</span>, <span class="ruby-ivar">@hash_of_lists_of_steps</span>[<span class="ruby-identifier">type</span>])
73:         <span class="ruby-keyword kw">end</span>
74:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000159" class="method-detail">
        <a name="M000159"></a>

        <div class="method-heading">
          <a href="#M000159" class="method-signature">
          <span class="method-name">clear</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000159-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000159-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/rspec/lib/spec/story/step_group.rb, line 59</span>
59:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">clear</span>
60:         <span class="ruby-ivar">@hash_of_lists_of_steps</span>.<span class="ruby-identifier">clear</span>
61:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000163" class="method-detail">
        <a name="M000163"></a>

        <div class="method-heading">
          <a href="#M000163" class="method-signature">
          <span class="method-name">create_matcher</span><span class="method-args">(type, name, &amp;block)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
TODO - make me private
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000163-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000163-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/rspec/lib/spec/story/step_group.rb, line 81</span>
81:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">create_matcher</span>(<span class="ruby-identifier">type</span>, <span class="ruby-identifier">name</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
82:         <span class="ruby-identifier">matcher</span> = <span class="ruby-constant">Step</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">name</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
83:         <span class="ruby-ivar">@hash_of_lists_of_steps</span>[<span class="ruby-identifier">type</span>] <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">matcher</span>
84:         <span class="ruby-identifier">matcher</span>
85:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000160" class="method-detail">
        <a name="M000160"></a>

        <div class="method-heading">
          <a href="#M000160" class="method-signature">
          <span class="method-name">empty?</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000160-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000160-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/rspec/lib/spec/story/step_group.rb, line 63</span>
63:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">empty?</span>
64:         [<span class="ruby-identifier">:given_scenario</span>, <span class="ruby-identifier">:given</span>, <span class="ruby-identifier">:when</span>, <span class="ruby-identifier">:then</span>].<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">type</span><span class="ruby-operator">|</span>
65:           <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@hash_of_lists_of_steps</span>[<span class="ruby-identifier">type</span>].<span class="ruby-identifier">empty?</span>
66:         <span class="ruby-keyword kw">end</span>
67:         <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">true</span>
68:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000149" class="method-detail">
        <a name="M000149"></a>

        <div class="method-heading">
          <a href="#M000149" class="method-signature">
          <span class="method-name">find</span><span class="method-args">(type, name)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000149-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000149-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/rspec/lib/spec/story/step_group.rb, line 27</span>
27:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">find</span>(<span class="ruby-identifier">type</span>, <span class="ruby-identifier">name</span>)
28:         <span class="ruby-ivar">@hash_of_lists_of_steps</span>[<span class="ruby-identifier">type</span>].<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">step</span><span class="ruby-operator">|</span>
29:           <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">step</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">step</span>.<span class="ruby-identifier">matches?</span>(<span class="ruby-identifier">name</span>)
30:         <span class="ruby-keyword kw">end</span>
31:         <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">nil</span>
32:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000155" class="method-detail">
        <a name="M000155"></a>

        <div class="method-heading">
          <span class="method-name">given</span><span class="method-args">(name, &amp;block)</span>
        </div>
      
        <div class="method-description">
          <p>
Alias for <a href="StepGroup.html#M000151">Given</a>
</p>
        </div>
      </div>

      <div id="method-M000154" class="method-detail">
        <a name="M000154"></a>

        <div class="method-heading">
          <span class="method-name">given_scenario</span><span class="method-args">(name, &amp;block)</span>
        </div>
      
        <div class="method-description">
          <p>
Alias for <a href="StepGroup.html#M000150">GivenScenario</a>
</p>
        </div>
      </div>

      <div id="method-M000157" class="method-detail">
        <a name="M000157"></a>

        <div class="method-heading">
          <span class="method-name">then</span><span class="method-args">(name, &amp;block)</span>
        </div>
      
        <div class="method-description">
          <p>
Alias for <a href="StepGroup.html#M000153">Then</a>
</p>
        </div>
      </div>

      <div id="method-M000156" class="method-detail">
        <a name="M000156"></a>

        <div class="method-heading">
          <span class="method-name">when</span><span class="method-args">(name, &amp;block)</span>
        </div>
      
        <div class="method-description">
          <p>
Alias for <a href="StepGroup.html#M000152">When</a>
</p>
        </div>
      </div>


    </div>


  </div>


<div id="validator-badges">
  <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>

</body>
</html>